//
//  KLMModeCardTimeCell.swift
//  KLM_GN
//
//  Created by Nic on 2025/3/7.
//

import UIKit

class KLMModeCardTimeCell: UICollectionViewCell {
    @IBOutlet weak var bgView: UIImageView!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var tipLabel: UILabel!
    
    var modeCard: KLMCard! {
        didSet {
            timeLabel.text = modeCard.title
            tipLabel.text = modeCard.subTitle
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        timeLabel.configStyle(font: UIFont(safeName: "PingFangSC-Heavy", size: 28))
        tipLabel.configStyle(font: UIFont(safeName: "PingFangSC-Medium", size: 12))
        
        layer.shadowColor = rgba(0, 0, 0, 0.17).cgColor
        layer.shadowOffset = CGSize(width: 0, height: 1)
        layer.shadowOpacity = 0.17
        layer.shadowRadius = 4
        layer.masksToBounds = false
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        if modeCard.select {
            tipLabel.configStyle(titleColor: rgba(0, 0, 0, 1))
            bgView.image = UIImage.image(withColor: rgba(246, 253, 250, 1), size: bounds.size, cornerRadius: 8.0, borderColor: appMainThemeColor, borderWidth: 1)
//            bgView.image = UIImage.image(withColor: rgba(246, 253, 250, 1), size: bounds.size, cornerRadius: 8.0)
        } else {
            tipLabel.configStyle(titleColor: rgba(129, 129, 129, 1))
            bgView.image = UIImage.image(withColor: rgba(247, 247, 247, 1), size: bounds.size, cornerRadius: 8.0, borderColor: rgba(233, 233, 233, 1), borderWidth: 1)
        }
    }
}
